<?php
/*
Template Name: Subpage
*/
?>


<?php get_header(); ?>

<?php get_template_part('flashing-page'); ?>

<div id="innerContainer" class="span-2">
<div id="sidebar">
<ul id="subNav">
<?php 
// use wp_list_pages to display parent and all child pages all generations (a tree with parent)
$parent = $post->post_parent;
$args=array(
  'title_li' =>	'',
  'child_of' => $parent,
  'sort_column' => 'menu_order'
);
wp_list_pages( $args ); ?>
</ul>
</div>
<div id="mainContent"> 
	
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div class="post" id="post-<?php the_ID(); ?>">
			<?php
//	global $post;
//$content = $post->post_name;
//echo $content;
 ?>
			<?php the_content('<p>Read the rest of this page &raquo;</p>'); ?>
			<?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
		</div>
		<?php endwhile; endif; ?>
	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div><!-- mainContent -->
</div><!-- innerContainer -->	

<?php get_sidebar(); ?>

<div class="clear"></div>
<script type="text/javascript">
 $("ul#subNav").not( $("ul#subNav").has("li.control") ).find("li.dropdown").css({"display":"block"});
 $(function () {
	$("li.control a").toggle(
      function () {
        $("li.dropdown").css({"display":"block"});
      },
      function () {
        $("li.dropdown").css({"display":"none"});
      }
    );
 });
</script>

<?php get_footer(); ?>
